package com.closer.server.api;

import com.closer.server.biz.organization.dto.SearchRequest;
import com.closer.server.biz.organization.dto.vo.OrganizationVO;
import com.closer.server.biz.organization.service.OrganizationService;
import com.closer.server.support.common.BaseResponse;
import com.closer.server.support.common.ResultUtils;
import com.mybatisflex.core.paginate.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/organization")
public class OrganizationController {

    private final OrganizationService organizationService;

    public OrganizationController(OrganizationService organizationService) {
        this.organizationService = organizationService;
    }

    @PostMapping("/search")
    public BaseResponse<Page<OrganizationVO>> search(@RequestBody SearchRequest params){

        var result = organizationService.search(params);
        return ResultUtils.success(result);
    }
}
